#!/bin/bash

# ----------------------------------------------------------------------
# Filename:   tomcat_version.sh
# Version:    1.0
# Date:       2013/11/12
# Author:     huijing.hei
# Email:      huijing.hei@cs2c.com.cn
# Summary:    02系统基本功能-04网络服务-13Tomcat服务-02查看版本信息
# Notes:       ***
# Copyright:    China Standard Software Co., Ltd.
# History：     
#             Version 1.0, 2013/11/12
#             - check tomcat version.
# ----------------------------------------------------------------------

##! @TODO: start&stop http service
##! @AUTHOR: huijing.hei
##! @VERSION: 1.0 
##! @OUT: 0 => success; 1 => failure

function do_test()
{
    which tomcat > /dev/null 2>&1
    [ $? -eq 0 ] && serv=tomcat

    which tomcat6 > /dev/null 2>&1
    [ $? -eq 0 ] && serv=tomcat6
    
    [ "x" != "x${serv}" ]
    EchoResult "${serv} service exits"

    ${serv} version

    version=`${serv} version |grep number |awk '{print $3}'|tr -d '\n'`
    [ "x" != "x${version}" ]
    EchoResult "${serv} version: ${version}"

}


# include lib files

if [ -z "$SFROOT" ]
then
    CMDLIB=./
    SFROOT=./
else
    CMDLIB=${SFROOT}/testcases/Network_Service
fi

. ${SFROOT}/lib/Echo.sh
. ${CMDLIB}/lib/Net.sh

do_test
EchoResult "testcase: ${serv} version"
